<template>
  <div class="subjectlist">
    <headers>
      <span slot="title">严选专栏</span>
    </headers>
    <ul id="special_content">
      <li v-for="(item, index) in subjectlist" :key="index">
        <img :src="item.pic" />
        <p v-html=" item.title "></p>
        <p v-html="item.descript"></p>
        <p @click="gotosubject_list_details(item.id)">查看详情</p>
      </li>
    </ul>
  </div>
</template>
<script>
  import headers from '../../components/headers.vue';
  export default {
    components: {
      headers
    },
    data() {
      return {
        subjectlist: [],
      };
    },
    methods: {
      gotosubject_list_details(id) {
        this.$router.push({path:this.$path.SUBJECT_LIST_DETAILS,query:{id}})
      }

    },
    mounted() {
      this.$API.subject_list().then((res) => {
        // console.log(res);

        this.subjectlist = res.data.data
      }).catch((err) => {
        console.log(err);
      });
    },

  };
</script>
<style lang="scss" scoped>
  .subjectlist {
    width: 100%;
    height: 100%;
    display: flex;
    flex-flow: column;

  }

  #special_content {
    flex: 1;
    overflow: scroll;
    padding-top: 0.7rem;
    padding-bottom: 0.2rem;

    li {
      padding: 0.1rem;
      text-align: center;
      position: relative;
      height: 32vh;

      img {
        width: 100%;
        height: 100%;
        display: block;
        background: rgba(0, 0, 0, 0.7);
      }

      p:nth-of-type(1) {
        position: absolute;
        top: 8vh;
        left: 10%;
        width: 80%;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 1rem;
        color: white;
      }

      p:nth-of-type(2) {
        position: absolute;
        top: 13vh;
        left: 10%;
        width: 80%;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.8rem;
        color: white;
      }

      p:nth-of-type(3) {
        position: absolute;
        top: 18vh;
        left: 7.8rem;
        width: 20%;
        height: 2rem;
        text-align: center;
        line-height: 2rem;
        font-size: 0.18rem;
        color: white;
        border: 0.01rem solid #ffffff;
        border-radius: 0.5rem;
      }

    }
  }
</style>